<?php

require_once "gui/spGuiListBoxNED.php";

class spPageNED extends spPage
{
	private $param;
	private $container;
	
	public function __construct( $param )
	{
		parent::__construct();
	
		// create defaults if not supplied
		$this->param = array_merge(
			array(
				"heading"			=> "",
				"heading_img"		=> "",
				"ned"				=> array()
			),
			$param==null?array():$param
		);
		
		parent::spRenderDefaults();
		parent::spRenderHeading( $param["heading"], $param["heading_img"] );

		$table = new spTable(array(
			"x" => "2",
			"y" => "1",
			"style_td" => array(
				"vertical-align" => "top"
			)
		));
		parent::addChild( $table );
		
		// create the container
		$this->container = new spDiv(array(
			"style" => array(
				"float" 	=> "left",
				"padding"	=> "10px"
			)
		));
		
		// add listboxes here
		foreach ( $param["ned"] as $pp )
		{
			$pp["databaseinfo"] = "#databaseinfo";

			$listboxNED = new spGuiListBoxNED( $pp );
			$this->container->addChild( $listboxNED );
		}

		$table->setCell( 0, 0, $this->container );
		
		$table->setCell( 1, 0, new spDiv(array( 
			"id" => "databaseinfo",
			"style"=>array(
				"float" => "left",
				"padding" => "10px"
			)
		)));		
	}	

	public function getContainer()
	{
		return $this->container;
	}
}

?>